package com.itheima;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
//使用SimpleDateFormat创建对象 对象.parse 对象.format
public class Test2 {
    public static void main(String[] args) throws ParseException {
        //使用SimpleDateFormat对象完成 字符串和Date对象的互相转换
        SimpleDateFormat pattern = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
       // LocalDateTime ldt = LocalDateTime.of(2020, 9, 10, 19, 8, 56);
        String s="1999-01-01 10-12-30";
        //String ->date
        Date parse = pattern.parse(s);
        //date- >String
        Date date = new Date();
        String format = pattern.format(date);

    }
}
